<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <h:panelGrid columns="3">         
            <h:outputLabel value="Bill No"/>
            <h:outputLabel value="Item Name"/>
            <h:outputLabel value="Item Code"/>
            <p:inputText autocomplete="off"  value="#{searchController.searchKeyword.billNo}" />
            <p:inputText autocomplete="off" value="#{searchController.searchKeyword.itemName}"/>
            <p:inputText autocomplete="off" value="#{searchController.searchKeyword.code}"/>
        </h:panelGrid>
        <p:dataTable rowIndexVar="i"  value="#{searchController.bills}" var="bill" >
            <f:facet name="header">
                <h:outputLabel value="ADJUST BILL SEARCH"/>
            </f:facet>

            <p:column>
                <p:commandButton ajax="false" action="/pharmacy/pharmacy_reprint_adjustment" value="View BIll">
                    <f:setPropertyActionListener value="#{bill}" target="#{pharmacyBillSearch.bill}"/>
                </p:commandButton>
            </p:column>
            <p:column headerText="BILL NO"  >                
                <h:outputLabel value="#{bill.deptId}"  ></h:outputLabel>                    
            </p:column>    


            <p:column headerText="Billed at"  >

                <h:outputLabel value="#{bill.createdAt}" >
                    <f:convertDateTime pattern="dd MM yyyy hh mm a"/>
                </h:outputLabel>
                <br/>
                <h:panelGroup rendered="#{bill.cancelled}" >
                    <h:outputLabel style="color: red;" value="Cancelled at " />
                    <h:outputLabel style="color: red;" rendered="#{bill.cancelled}" value="#{bill.cancelledBill.createdAt}" >
                        <f:convertDateTime pattern="dd MMM yyyy hh mm a"/>
                    </h:outputLabel>
                </h:panelGroup>               
            </p:column>                 
            <p:column headerText="Billed by" >            
                <h:outputLabel value="#{bill.creater.webUserPerson.name}" >                                      
                </h:outputLabel>                
                <br/>
                <h:panelGroup rendered="#{bill.cancelled}" >
                    <h:outputLabel style="color: red;" value="Cancelled By " />
                    <h:outputLabel style="color: red;" rendered="#{bill.cancelled}" 
                                   value="#{bill.cancelledBill.creater.webUserPerson.name}" >                                       
                    </h:outputLabel>
                </h:panelGroup>               
            </p:column>       

            <p:column headerText="Comments" >               
                <h:outputLabel   value="#{bill.comments}" >
                </h:outputLabel>
            </p:column>
        </p:dataTable>
    </cc:implementation>
</html>